package com.emergency.assist.controller;

import com.emergency.assist.service.AreaService;
import com.emergency.base.domain.Area;
import com.emergency.base.domain.Plan;
import com.emergency.common.entity.Result;
import com.emergency.common.entity.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by lijie on 2019/10/17.
 */
@RestController
@RequestMapping("/division")
@Api(value="区域划分类",description = "根据当前数据分析各大主要区域范围图，提供撤离辅助")
public class DivisionController {

    @Autowired
    private AreaService areaService;

    @ApiOperation(value = "区域划分接口" ,  notes="按照指挥系统的计划方案，计算分析主要区域位置和范围")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "plan", value = "计划方案", required = true, paramType = "query", dataType = "Plan"),
            @ApiImplicitParam(name = "type", value = "类型", required = true, paramType = "query", dataType = "int")
    })
    @RequestMapping(value = "area",method = RequestMethod.POST)
    public Result area(@RequestBody Plan plan, @RequestParam int type){
        List<Area> areaList=areaService.areaPlanning(plan,type);
        return new Result(true, StatusCode.OK,  "分析成功", areaList);
    }
}
